#pragma once
#include <iostream>
#include <pthread.h>


// Conditional Variable
class Conditional
{
private:
    pthread_cond_t _cond;
public:
    Conditional()
    {
        pthread_cond_init(&_cond,nullptr);
    }
    ~Conditional()
    {
        pthread_cond_destroy(&_cond);
    }
    void Signal()
    {
        pthread_cond_signal(&_cond);
    }
    void BroadCast()
    {
        pthread_cond_broadcast(&_cond);
    }
    void Wait(Mutex& mutex)
    {
        pthread_cond_wait(&_cond,&mutex._mtx);
    }
};